package touche.touche;

import model.ScoresList;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ScoreActivity extends Activity implements View.OnClickListener {
	private Button _buttonWorld;
	private Button _buttonLocal;
	private Button _buttonMenu;

	private TextView _textViewRank;
	private TextView _textViewScores;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.score);

		_buttonWorld = (Button) findViewById(R.id.buttonWorld);
		_buttonWorld.setOnClickListener(this);

		_buttonLocal = (Button) findViewById(R.id.buttonLocal);
		_buttonLocal.setOnClickListener(this);

		_buttonMenu = (Button) findViewById(R.id.buttonMenu);
		_buttonMenu.setOnClickListener(this);

		_textViewRank = (TextView) findViewById(R.id.textViewRank);
		_textViewScores = (TextView) findViewById(R.id.textViewScores);

		_textViewScores.setText(ScoresList.getInstance()
				.getStringScoreListLocal());
		

		TelephonyManager telephonyManager = (TelephonyManager) getBaseContext()
				.getSystemService(Context.TELEPHONY_SERVICE);
		
		_textViewRank.setText(ScoresList.getInstance().getStringRank(telephonyManager.getDeviceId()));
	}

	public void onClick(View v) {
		if (_buttonWorld == v) {
			_textViewScores.setText(ScoresList.getInstance()
					.getStringScoreListWorld());
		} else if (_buttonLocal == v) {
			_textViewScores.setText(ScoresList.getInstance()
					.getStringScoreListLocal());
		} else if (_buttonMenu == v) {
			finish();
		}
	}
}